/*
 * This file is part of aion-unique <aion-unique.org>.
 *
 *  aion-unique is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  aion-unique is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with aion-unique.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.aionengine.gameserver.services;

import com.aionengine.gameserver.model.gameobjects.player.Player;
import com.aionengine.gameserver.network.aion.serverpackets.SM_CHAT_INIT;
import com.aionengine.gameserver.network.chatserver.ChatServer;
import com.aionengine.gameserver.utils.PacketSendUtility;
import com.aionengine.gameserver.world.World;

/**
 * @author ATracer
 */
public class ChatService {

    private static byte[] ip = {127, 0, 0, 1};
    private static int port = 10241;

    /**
     * Disonnect from chat server
     *
     * @param player
     */
    public static void onPlayerLogout(Player player) {
        ChatServer.getInstance().sendPlayerLogout(player);
    }

    /**
     * @param playerId
     * @param token
     * @param account
     * @param nick
     */
    public static void playerAuthed(int playerId, byte[] token) {
        Player player = World.getInstance().findPlayer(playerId);
        if (player != null) {
            PacketSendUtility.sendPacket(player, new SM_CHAT_INIT(token));
        }
    }

    /**
     * @return the ip
     */
    public static byte[] getIp() {
        return ip;
    }

    /**
     * @return the port
     */
    public static int getPort() {
        return port;
    }

    /**
     * @param ip the ip to set
     */
    public static void setIp(byte[] _ip) {
        ip = _ip;
    }

    /**
     * @param port the port to set
     */
    public static void setPort(int _port) {
        port = _port;
    }
}
